package cn.hct.springboot_pro.service.impl;

import cn.hct.springboot_pro.dao.ItemMapper;
import cn.hct.springboot_pro.entity.Item;
import cn.hct.springboot_pro.service.ItemService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Repository;
import org.springframework.stereotype.Service;

import java.util.List;

@Repository
@Service
public class ItemServiceImpl implements ItemService {

    @Autowired
    ItemMapper itemDao;

    @Override
    public int addItem(String item_name, int user_id, String type, int price, String introduction, String image, String publish_time) {
        return itemDao.addItem(item_name,user_id,type,price,introduction,image,publish_time);
    }

    @Override
    public List<Item> getAllItemOnTime() {
        return itemDao.getAllItemOnTime();
    }

    @Override
    public Item getItemById(int item_id) {
        return itemDao.getItemById(item_id);
    }

    @Override
    public int updateIStateByid(int item_id, int item_state) {
        return itemDao.updateIStateByid(item_id,item_state);
    }

    @Override
    public List<Item> getItemByType(String type) {
        return itemDao.getItemByType(type);
    }

    @Override
    public List<Item> getItemByUid(int user_id) {
        return itemDao.getItemByUid(user_id);
    }

    @Override
    public List<Item> searchLikeItem(String item_name) {
        return itemDao.searchLikeItem(item_name);
    }

    @Override
    public List<Item> searchLikeItemPage(String item_name,int pageNo,int pageSize) {
        return itemDao.searchLikeItemPage(item_name,pageNo,pageSize);
    }

    @Override
    public List<Item> getItem() {
        return itemDao.getItem();
    }

    @Override
    public int updateItem(Item item) {
        return itemDao.updateItem(item);
    }

    @Override
    public int deleteItemById(int item_id) {
        return itemDao.deleteItemById(item_id);
    }
}
